package com.nineclock.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nineclock.system.pojo.SysCompany;
import com.nineclock.system.pojo.SysCompanyUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * @author 黑马程序员
 * @Company http://www.ithiema.com
 * @Version 1.0
 */
@Mapper
public interface SysCompanyMapper extends BaseMapper<SysCompany> {

    @Select("SELECT * FROM sys_company_user WHERE id = (" +
            "SELECT company_user_id FROM sys_company_user_role " +
            "WHERE company_id = 1 " +
            "AND role_id = " +
            "(SELECT id FROM sys_role WHERE company_id = 1 AND role_name = 'ROLE_ADMIN_SYS')" +
            ")")


    SysCompanyUser queryCurrentAdmin(Long companyId);
}
